package com.personal.system.controller.content.web;

import com.personal.common.result.Result;
import com.personal.system.service.content.web.ApiImMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/blog/v1/im")
@Api(tags = "聊天管理-门户")
@RequiredArgsConstructor
public class ApiImMessageController {

    private final ApiImMessageService imMessageService;
    
//    @GetMapping(value = "/")
//    @ApiOperation(value = "获取历史聊天记录", httpMethod = "GET", response = Result.class, notes = "获取历史聊天记录")
//    public Result selectHistoryList() {
//        return  imMessageService.selectHistoryList();
//    }
//
//    @GetMapping(value = "/getRoomList")
//    @ApiOperation(value = "获取房间列表", httpMethod = "GET", response = Result.class, notes = "获取房间列表")
//    public Result selectRoomList() {
//        return imMessageService.selectRoomList();
//    }
//
//    @GetMapping(value = "/selectUserImHistory")
//    @ApiOperation(value = "获取单聊历史消息", httpMethod = "GET", response = Result.class, notes = "获取单聊历史消息")
//    public Result selectUserImHistoryList(String fromUserId,String toUserId) {
//        return  imMessageService.selectUserImHistoryList(fromUserId,toUserId);
//    }
//
//    @PostMapping(value = "/chat")
//    @ApiOperation(value = "发送消息", httpMethod = "POST", response = Result.class, notes = "发送消息")
//    public Result chat(@RequestBody ImMessageVO message){
//        return imMessageService.chat(message);
//    }
//
//    @PostMapping(value = "/withdraw")
//    @ApiOperation(value = "撤回消息", httpMethod = "POST", response = Result.class, notes = "撤回消息")
//    public Result withdraw(@RequestBody ImMessageVO message){
//        return imMessageService.withdraw(message);
//    }
//
//    @GetMapping(value = "/read")
//    @ApiOperation(value = "已读消息", httpMethod = "GET", response = Result.class, notes = "已读消息")
//    public Result read(String userId) {
//        return imMessageService.read(userId);
//    }
//
//    @DeleteMapping(value = "/deleteRoom")
//    @ApiOperation(value = "删除房间", httpMethod = "DELETE", response = Result.class, notes = "删除房间")
//    public Result deleteRoom(String roomId) {
//        return imMessageService.deleteRoom(roomId);
//    }
//
//    @PostMapping(value = "/addRoom")
//    @ApiOperation(value = "创建房间（即点击私信按钮）", httpMethod = "POST", response = Result.class, notes = "创建房间（即点击私信按钮）")
//    public Result addRoom(String userId) {
//        return imMessageService.addRoom(userId);
//    }
//
    @GetMapping(value = "/getMessageNotice")
    @ApiOperation(value = "获取系统通知", httpMethod = "GET", response = Result.class, notes = "获取系统通知")
    public Result getMessageNotice(Integer type) {
        return imMessageService.getMessageNotice(type);
    }

    @GetMapping("/getNewSystemNotice")
    @ApiOperation(value = "获取未读的最新通知", httpMethod = "GET", response = Result.class, notes = "获取未读的最新通知")
    public Result getNewSystemNotice(){
        return imMessageService.getNewSystemNotice();
    }

    @DeleteMapping("/deleteMessage")
    @ApiOperation(value = "根据类型删除所有消息", httpMethod = "DELETE", response = Result.class, notes = "根据类型删除所有消息")
    public Result deleteMessage(String id,Integer type){
        return imMessageService.deleteByNoticeType(id,type);
    }

}
